import UIKit
import flutter_boost
import FlutterPluginRegistrant

@UIApplicationMain
class AppDelegate: FlutterAppDelegate { // More on the FlutterAppDelegate.
    lazy var flutterEngine = FlutterEngine(name: "my flutter engine")
  override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      flutterEngine.run();
      GeneratedPluginRegistrant.register(with: self.flutterEngine);
      initWindow(application, didFinishLaunchingWithOptions: launchOptions)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions);
  }
    
    
    func initWindow(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
        print("launchOptions --- \(String(describing: launchOptions))")
        let homeVC =  ViewController()
        let nav = UINavigationController(rootViewController: homeVC)
        window?.backgroundColor = .white
        window?.rootViewController = nav
        window?.makeKeyAndVisible()
        
//        创建代理，做初始化操作
        let delegate = VRBoostDelegate()
        delegate.navigationController = nav
        FlutterBoost.instance().setup(application, delegate: delegate, callback: { engine in})
    }
}
